DEFINITION MODULE IPF;

  (* IBM OS/2 IPF file support.
   * (c)1994 by rps *)

  TYPE
    BYTESET =           SET OF [0..7];
    WORDSET =           SET OF [0..15];
    LONGSET =           SET OF [0..31];

  TYPE
    aCount =            INTEGER;
    anIndex =           [0 .. MAX(CARDINAL) DIV 4 - 10];
    aLength =           INTEGER;

  TYPE
    aString =           ARRAY [0..255] OF CHAR;
    aTocEntry =         RECORD
      flags:              BYTESET;
      slotCnt:            aCount;
      slot:               POINTER TO ARRAY anIndex OF anIndex;
      title:              POINTER TO aString;
      nest:               CARDINAL;
                        END;
  CONST (*flags*)
    HasChildren =       7;
    Hidden =            6;
    Extended =          5;
    (* lowest 4 bits give nesting level *)

  TYPE
    anIdxEntry =        RECORD
      level:              CARDINAL;
      toc:                anIndex;
      name:               POINTER TO aString;
                        END;

  TYPE
    aWord =             SHORTCARD;
    aSlotEntry =        RECORD
      localCnt:           aWord;
      local:              POINTER TO ARRAY aWord OF anIndex;  (* into dict *)
      textCnt:            aCount;
      text:               POINTER TO ARRAY anIndex OF aWord;  (* into local *)
                        END;

  TYPE
    aTocPtr =   POINTER TO aTocEntry;
    anIdxPtr =  POINTER TO anIdxEntry;
    aDictPtr =  POINTER TO aString;
    aSlotPtr =  POINTER TO aSlotEntry;

  VAR
    Title:      aString;
    TocCnt:     anIndex;
    Toc:        POINTER TO ARRAY anIndex OF aTocPtr;
    IdxCnt:     anIndex;
    Idx:        POINTER TO ARRAY anIndex OF anIdxPtr;
    DictCnt:    anIndex;
    Dict:       POINTER TO ARRAY anIndex OF aDictPtr;
    SlotCnt:    anIndex;
    Slot:       POINTER TO ARRAY anIndex OF aSlotPtr;


  PROCEDURE Open (fname: ARRAY OF CHAR);
  PROCEDURE Close;

END IPF.
